/**
 * Created by Administrator on 2016/11/28.
 */
$(".form-date").datetimepicker(
    {
      language: "zh-CN",
      weekStart: 1,
      todayBtn: 1,
      autoclose: 1,
      todayHighlight: 1,
      startView: 2,
      minView: 2,
      forceParse: 0,
      format: "yyyy-mm-dd"
    });
/**
 * Created by Administrator on 2016/11/15.
 */
$(function () {
  initDom();
  initEvent();
})

function initDom() {

  $("#kinds-content").hide();
  $("#qhTable_project").bootstrapTable({
    height: "900px",
    url: "workType.json",
    onExpandRow: orderGoodsFun
  });
  $(".fixed-table-header table").css("display", "");
  $("#qhTable_project").css("display", "");
  $(".fixed-table-body table").css('margin-top', '0');
  $(".fixed-table-toolbar .fixed-table-container").css({"padding-bottom": "0"});

}
function initEvent() {

}
function orderGoodsFun(index, row, detail) {
  console.log("展开行：" + index + "   整行的值是：");
  console.log(row);
  $.getJSON("goods/data.json?", function (response) {
    var htmlStr = template('goodsTplScript', response);
    detail.html(htmlStr);
  });
}
/* 新增  编辑 */
function totalFormatter(value, row, index) {
}
function newClick() {
  //var heightW=$(window).height();
  //console.log(heightW);
  var index = layer.open({
    type: 2,
    title: false,
    shadeClose: true,
    shade: false,
    maxmin: false, //开启最大化最小化按钮
    area: ['500px', '288px'],
    content: 'new.html'
  });
}

function totalFormatter(value, row, index) {
  return `<div class='edit-del'>
        <input type='button' class='btn btn-primary edit'
         disabled onclick='editClick()' value='编辑'>
        <input type='button' disabled class='btn btn-primary del'
         onclick="deleteBtn(this)" value='删除'>
        </div>`
}
$(".edit-del").css("text-align", "center");
function deleteBtn(btn) {
  var id = $(btn).parent().parent().children(':first-child').html();
  var url = "";
  $.ajax({
    url: url,
    type: "delete",
    success: function () {
    },
    error: function () {
    }
  })
}

function editClick() {
  var index = layer.open({
    type: 2,
    title: false,
    shadeClose: true,
    shade: false,
    maxmin: false, //开启最大化最小化按钮
    area: ['500px', '335px'],
    content: 'edit.html'
  });
}

function myQueryParams(params) {
  params["pageNum"] = (params.offset / params.limit) + 1;
  params.pageSize = params.limit;
  params.derection = "asc";
  params.sort = "id";

  params.orderCode = $("#orderCode").val() + "";
  return params;
}

function responseHandler(res) {
  var needData = {
    rows: res.data.list,
    total: res.data.total
  };
  return needData;
}





